package twoPointers;

public class maxErea {
    public int maxArea(int[] height) {
        int max=0;
        int left=0;
        int cur=0;
        int right=height.length-1;
        while(left<right){
            if(height[left]>height[right]){
                cur=(right-left)*height[right];
                max=Math.max(cur,max);
                right--;
            }else{
                cur=(right-left)*height[left];
                max=Math.max(cur,max);
                left++;
            }
        }
        return max;
    }
    public static void main(String[] args) {
    }
}
